<?php namespace Home\Controller; 
use Hdphp\Controller\Controller;

//前台默认控制器
class IndexController extends Controller{

    //首页
    public function index(){
      $cateModel=new \Common\Model\Cate;
      $cateData=$cateModel->where("pid=0")->get();
      foreach ($cateData as $k => $v) {

         $cateData[$k]['son']=$cateModel->where("pid={$v['cid']}")->get();
         foreach ($cateData[$k]['son'] as $key => $value) {
            $cateData[$k]['son'][$key]['gson']=$cateModel->where("pid={$value['cid']}")->get();
         };
      }
      
     // p($cateData);
      View::with('cateData',$cateData);
      View::make();
    }
}
